Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding abstraction to code and enhance the codecov #138

Merged
merged 13 commits into from
Aug 25, 2023

Conversation

Nageshbansal
Copy link
Contributor

@Nageshbansal Nageshbansal commented Jun 21, 2023

What this PR does / why we need it:
Adds Unit tests in controller/

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Checklist:

  • Fixes #
  • Labelled this PR & related issue with documentation tag
  • PR messages has document related information
  • Labelled this PR & related issue with breaking-changes tag
  • PR messages has breaking changes related information
  • Labelled this PR & related issue with requires-upgrade tag
  • PR messages has upgrade related information
  • Commit has unit tests
  • Commit has integration tests

@Nageshbansal
Copy link
Contributor Author

Nageshbansal commented Jul 10, 2023

Before Running Chaos-Experiment:

# HELP litmuschaos_cluster_scoped_awaited_experiments Total number of awaited experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_awaited_experiments gauge
litmuschaos_cluster_scoped_awaited_experiments 0
# HELP litmuschaos_cluster_scoped_experiments_installed_count Total number of experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_installed_count gauge
litmuschaos_cluster_scoped_experiments_installed_count 0
# HELP litmuschaos_cluster_scoped_experiments_run_count Total experiments run in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_run_count gauge
litmuschaos_cluster_scoped_experiments_run_count 0
# HELP litmuschaos_cluster_scoped_failed_experiments Total number of failed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_failed_experiments gauge
litmuschaos_cluster_scoped_failed_experiments 0
# HELP litmuschaos_cluster_scoped_passed_experiments Total number of passed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_passed_experiments gauge
litmuschaos_cluster_scoped_passed_experiments 0

During the Experiment Run:

# HELP litmuschaos_awaited_experiments Total number of awaited experiments
# TYPE litmuschaos_awaited_experiments gauge
litmuschaos_awaited_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete",workflow_name=""} 1
# HELP litmuschaos_cluster_scoped_awaited_experiments Total number of awaited experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_awaited_experiments gauge
litmuschaos_cluster_scoped_awaited_experiments 1
# HELP litmuschaos_cluster_scoped_experiments_installed_count Total number of experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_installed_count gauge
litmuschaos_cluster_scoped_experiments_installed_count 1
# HELP litmuschaos_cluster_scoped_experiments_run_count Total experiments run in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_run_count gauge
litmuschaos_cluster_scoped_experiments_run_count 1
# HELP litmuschaos_cluster_scoped_failed_experiments Total number of failed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_failed_experiments gauge
litmuschaos_cluster_scoped_failed_experiments 0
# HELP litmuschaos_cluster_scoped_passed_experiments Total number of passed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_passed_experiments gauge
litmuschaos_cluster_scoped_passed_experiments 0
# HELP litmuschaos_experiment_chaos_injected_time chaos injected time of the experiments
# TYPE litmuschaos_experiment_chaos_injected_time gauge
litmuschaos_experiment_chaos_injected_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1.688993234e+09
# HELP litmuschaos_experiment_end_time end time of the experiments
# TYPE litmuschaos_experiment_end_time gauge
litmuschaos_experiment_end_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0
# HELP litmuschaos_experiment_start_time start time of the experiments
# TYPE litmuschaos_experiment_start_time gauge
litmuschaos_experiment_start_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1.688993168e+09
# HELP litmuschaos_experiment_total_duration total duration of the experiments
# TYPE litmuschaos_experiment_total_duration gauge
litmuschaos_experiment_total_duration{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0
# HELP litmuschaos_experiment_verdict Verdict of the experiments
# TYPE litmuschaos_experiment_verdict gauge
litmuschaos_experiment_verdict{app_kind="deployment",app_label="app=nginx",app_namespace="litmus",chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",chaosresult_verdict="Awaited",fault_name="pod-delete",probe_success_percentage="0.000000",workflow_name=""} 0
# HELP litmuschaos_failed_experiments Total number of failed experiments
# TYPE litmuschaos_failed_experiments gauge
litmuschaos_failed_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0
# HELP litmuschaos_passed_experiments Total number of passed experiments
# TYPE litmuschaos_passed_experiments gauge
litmuschaos_passed_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0
# HELP litmuschaos_probe_success_percentage ProbeSuccessPercentage for the experiments
# TYPE litmuschaos_probe_success_percentage gauge
litmuschaos_probe_success_percentage{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0

After the Experiment Passed:

# HELP litmuschaos_awaited_experiments Total number of awaited experiments
# TYPE litmuschaos_awaited_experiments gauge
litmuschaos_awaited_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete",workflow_name=""} 0
# HELP litmuschaos_cluster_scoped_awaited_experiments Total number of awaited experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_awaited_experiments gauge
litmuschaos_cluster_scoped_awaited_experiments 0
# HELP litmuschaos_cluster_scoped_experiments_installed_count Total number of experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_installed_count gauge
litmuschaos_cluster_scoped_experiments_installed_count 1
# HELP litmuschaos_cluster_scoped_experiments_run_count Total experiments run in all namespaces
# TYPE litmuschaos_cluster_scoped_experiments_run_count gauge
litmuschaos_cluster_scoped_experiments_run_count 1
# HELP litmuschaos_cluster_scoped_failed_experiments Total number of failed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_failed_experiments gauge
litmuschaos_cluster_scoped_failed_experiments 0
# HELP litmuschaos_cluster_scoped_passed_experiments Total number of passed experiments in all namespaces
# TYPE litmuschaos_cluster_scoped_passed_experiments gauge
litmuschaos_cluster_scoped_passed_experiments 1
# HELP litmuschaos_experiment_chaos_injected_time chaos injected time of the experiments
# TYPE litmuschaos_experiment_chaos_injected_time gauge
litmuschaos_experiment_chaos_injected_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1.688993234e+09
# HELP litmuschaos_experiment_end_time end time of the experiments
# TYPE litmuschaos_experiment_end_time gauge
litmuschaos_experiment_end_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1.688993247e+09
# HELP litmuschaos_experiment_start_time start time of the experiments
# TYPE litmuschaos_experiment_start_time gauge
litmuschaos_experiment_start_time{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1.688993168e+09
# HELP litmuschaos_experiment_total_duration total duration of the experiments
# TYPE litmuschaos_experiment_total_duration gauge
litmuschaos_experiment_total_duration{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 79
# HELP litmuschaos_experiment_verdict Verdict of the experiments
# TYPE litmuschaos_experiment_verdict gauge
litmuschaos_experiment_verdict{app_kind="deployment",app_label="app=nginx",app_namespace="litmus",chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",chaosresult_verdict="Awaited",fault_name="pod-delete",probe_success_percentage="0.000000",workflow_name=""} 0
litmuschaos_experiment_verdict{app_kind="deployment",app_label="app=nginx",app_namespace="litmus",chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",chaosresult_verdict="Pass",fault_name="pod-delete",probe_success_percentage="100.000000",workflow_name=""} 1
# HELP litmuschaos_failed_experiments Total number of failed experiments
# TYPE litmuschaos_failed_experiments gauge
litmuschaos_failed_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 0
# HELP litmuschaos_passed_experiments Total number of passed experiments
# TYPE litmuschaos_passed_experiments gauge
litmuschaos_passed_experiments{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 1
# HELP litmuschaos_probe_success_percentage ProbeSuccessPercentage for the experiments
# TYPE litmuschaos_probe_success_percentage gauge
litmuschaos_probe_success_percentage{chaosengine_context="",chaosengine_name="nginx-chaos1",chaosresult_name="nginx-chaos1-pod-delete",chaosresult_namespace="litmus",fault_name="pod-delete"} 100

Signed-off-by: nagesh bansal <[email protected]>
ispeakc0de
ispeakc0de previously approved these changes Aug 14, 2023
Signed-off-by: nagesh bansal <[email protected]>
@Nageshbansal
Copy link
Contributor Author

@ispeakc0de , added some more cases. coverage is now 73%. PTAL

ispeakc0de
ispeakc0de previously approved these changes Aug 24, 2023
Signed-off-by: nagesh bansal <[email protected]>
@ispeakc0de ispeakc0de changed the title Adds Unit Tests in controller/ Adding abstruction to code and enhance the codecov Aug 25, 2023
@ispeakc0de ispeakc0de changed the title Adding abstruction to code and enhance the codecov Adding abstraction to code and enhance the codecov Aug 25, 2023
@ispeakc0de ispeakc0de merged commit 19f3788 into litmuschaos:master Aug 25, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants